﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace welding
{
    public partial class ChangePassword : Form
    {
        private string p;

     
        public ChangePassword()
        {
            InitializeComponent();
            lblMessage.Text = string.Empty;

        }

        public ChangePassword(string p)
        {
            InitializeComponent();
            lblMessage.Text = string.Empty;
            // TODO: Complete member initialization
            this.p = p;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if ((tbPwdFirst.Text.Trim() == string.Empty) || (tbPwdSecond.Text.Trim() == string.Empty))
            {
                lblMessage.Text = "密码不能为空";
                return;
            }

            if (tbPwdFirst.Text.Trim() != tbPwdSecond.Text.Trim())
            {
                lblMessage.Text = "密码不一致";
                return;
            }

        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            //this.Close();
        }

        private void ChangePassword_Load(object sender, EventArgs e)
        {

        }

        private void tbPwdFirst_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                tbPwdSecond.Focus();
            }

        }

        private void tbPwdSecond_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                btnOk.Focus();
            }

        }
    }
}
